from wordcloud import WordCloud
import matplotlib.pyplot as plt

with open("./data/第三页.txt","r",encoding="utf-8") as f:
    text = f.read()
wc = WordCloud(font_path="./pattern/FZSTK.TTF",background_color="white", \
               width=500,height=400,margin=2).generate(text)

fig,ax = plt.subplots(1,1,figsize=(17,12))
ax.imshow(wc)
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.spines["bottom"].set_visible(False)

ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
plt.show()
wc.to_file("./pattern/wc.png")
